1 /*
2 Copyright: Marcelo S. N. Mancini (Hipreme|MrcSnm), 2018 - 2021
3 License:   [https://creativecommons.org/licenses/by/4.0/|CC BY-4.0 License].
4 Authors: Marcelo S. N. Mancini
5 
6 	Copyright Marcelo S. N. Mancini 2018 - 2021.
7 Distributed under the CC BY-4.0 License.
8    (See accompanying file LICENSE.txt or copy at
9 	https://creativecommons.org/licenses/by/4.0/
10 */
11 /**
12 * This module is used for mantaining global options related to the engine
13 */ 
14 module hip.config.opts;
15 
16 
17 /**
18 *   Use that for mainly mantaining engine related debug things
19 */
20 enum HIP_DEBUG = true;
21 
22 /** 
23  * Will call HipRenderer.exitOnError for each glCall
24  */
25 enum HIP_DEBUG_GL = true;
26 
27 /** 
28  * Will call HipRenderer.exitOnError for each glCall.
29  *	WebGL has a bizarre glGetError in terms of performance, it can degradate it alone. This will possibily never be enabled.
30  */
31 enum HIP_DEBUG_WEBGL = false;
32 
33 /**
34 *   Used for disabling every engine log function
35 */
36 enum HE_NO_LOG = false;
37 
38 /**
39 *	Used to track calls to find where the print call is located.
40 */
41 enum HIP_TRACK_HIPLOG = false;
42 
43 /**
44 *   Mantain only error related logging
45 */
46 enum HE_ERR_ONLY = false; 
47 
48 ///Unused yet?
49 enum HIP_OPTIMIZE = false;
50 
51 /** 
52  * Default size that will be used at opening the engine window.
53  * Currently it is 1280 width, 720 height
54  */
55 immutable HIP_DEFAULT_WINDOW_SIZE = [1280, 720];
56 
57 ///Default time in millis to restart the click count on Mouse and Keyboard
58 enum HIP_DEFAULT_TIME_UNTIL_CLICK_COUNT_RESTART = 400;
59 
60 ///////////////////////////////// Default Asset Files /////////////////////////////////
61 enum HIP_ASSETMANAGER_WORKER_POOL = 8;
62 
63 ///8 ms makes FPS drop to 30. Useful for updating graphics and showing loading bars
64 enum HIP_ASSETMANAGER_MAX_PROCESS_MS = 8;
65 ///If partial load is true, It will use max process ms for loading files. But since it is task based, it might take more than MAX_PROCESS_MS
66 enum HIP_ASSETMANAGER_PARTIAL_LOAD = true;
67 
68 enum HIP_DEFAULT_FONT = "defaults/fonts/WarsawGothic-BnBV.otf";
69 enum HIP_DEFAULT_FONT_SIZE = 32;
70 enum HIP_DEFAULT_TEXTURE = "defaults/graphics/sprites/default.png";
71 
72 /**
73 *	Will use OpenSL ES optimal sample rate for output and buffer size multiple. 
74 */
75 enum HIP_OPENSLES_OPTIMAL = true;
76 
77 /**
78 *	Beware that a lot of effects are disabled on Android when using low latency, aka Fast Mixer.
79 *	So, it is better to have a deep thought before allowing its low latency.
80 *	You will also lose sample rate conversion, so it is a lot problematic. Until there's a hand made sample
81 *	converter, it will be almost impossible to use.
82 *
83 *	The following interfaces are unsupported on the fast mixer:
84 *
85 *   - SL_IID_BASSBOOST
86 *
87 *   - SL_IID_EFFECTSEND
88 *
89 *   - SL_IID_ENVIRONMENTALREVERB
90 *
91 *   - SL_IID_EQUALIZER
92 *
93 *   - SL_IID_PLAYBACKRATE
94 *
95 *   - SL_IID_PRESETREVERB
96 *
97 *   - SL_IID_VIRTUALIZER
98 *
99 *   - SL_IID_ANDROIDEFFECT
100 *
101 *   - SL_IID_ANDROIDEFFECTSEND
102 *
103 */
104 enum HIP_OPENSLES_FAST_MIXER = false;
105 
106 
107 
108 static if(HIP_OPENSLES_FAST_MIXER)
109 {
110 	static assert(HIP_OPENSLES_OPTIMAL, "Can't use OpenSL ES fast mixer without using its optimal 
111 buffer size and sample rate");
112 }
113 
114 
115 version(WebAssembly) 
116 	enum CustomRuntime = true;
117 else version(CustomRuntimeTest) 
118 	enum CustomRuntime = true;
119 else version(PSVita) 
120 	enum CustomRuntime = true;
121 else
122 	enum CustomRuntime = false;
123 
124 
125 static if(CustomRuntime)
126 	enum HipConcurrency = false;
127 else version(Windows) 
128 	enum HipConcurrency = true;
129 else version(Android)
130 	enum HipConcurrency = true;
131 else version(UWP)
132 	enum HipConcurrency = true;
133 else version(AppleOS)
134 	enum HipConcurrency = true;
135 else version(linux) 
136 	enum HipConcurrency = true;